/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import entity.Feedback;
import java.util.Date;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author VietTien
 */
@Stateless
public class FeedbackFacade extends AbstractFacade<Feedback> {

    @PersistenceContext(unitName = "BluePumpkin-ejbPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public FeedbackFacade() {
        super(Feedback.class);
    }

    public void editFB(Feedback fb) {
        Feedback f = em.find(Feedback.class, fb.getFeedbackID());
        f.setAnswer(fb.getAnswer());
        Date d = new Date();
        f.setCommentDate(d);
        em.merge(f);
    }

    public void editNull(Feedback fb) {
        Feedback f = em.find(Feedback.class, fb.getFeedbackID());
        f.setAnswer(null);
        Date d = new Date();
        f.setCommentDate(null);
      
    }
}
